import store from '@/store'
import { listTotree } from '@/utils/index'
// 此文件用于配置项和相关参数设置

// 详情展示页
// 基本信息
// 基础信息模块
const detailInfo = [{
  label: '设备名称',
  name: 'name',
  value: '1'
},
{
  label: '固定资产编码',
  name: 'fixAssetCode',
  value: '1'
},
{
  label: '设备编号',
  name: 'deviceNumber',
  value: '1'
},
{
  label: '设备类别',
  name: 'deviceType',
  value: '1'
},
{
  label: '设备分类',
  name: 'deviceClass',
  value: '1'
},
{
  label: '使用部门',
  name: 'useDepartment',
  value: '1'
},
{
  label: '责任人',
  name: 'responsible',
  value: '1'
},
{
  label: '投产日期',
  name: 'productDate',
  value: '1'
},
{
  label: '出厂编号',
  name: 'factoryNumber',
  value: '1'
},
{
  label: '型号',
  name: 'model',
  value: '1'
},
{
  label: '设备原值',
  name: 'deviceValue',
  value: '1'
},
{
  label: '使用年限',
  name: 'usedYears',
  value: '1'
},
{
  label: '设备主图',
  name: 'mainDrawFile',
  value: '1'
}
]
const broadInfo = [{
  label: '扩展字段1',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段2',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段3',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段4',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段5',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段6',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段7',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段7',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段8',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段9',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段10',
  name: 'name',
  value: '1'
},
{
  label: '扩展字段11',
  name: 'name',
  span: 24,
  value: '123456781234567812345678123456781234567812345678'
}
]
const histroyShowInfo = [{
  label: '一级 1',

  children: [{
    label: '二级 1-1',
    imgSrc: 'https://panjiachen.gitee.io/vue-element-admin/static/img/404.a57b6f31.png'
  }]
},
{
  label: '一级 2',
  children: [{
    label: '二级 2-1',
    imgSrc: 'https://panjiachen.gitee.io/vue-element-admin/static/img/404.a57b6f31.png'
  },
  {
    label: '二级 2-2',
    imgSrc: 'https://panjiachen.gitee.io/vue-element-admin/static/img/404.a57b6f31.png'
  }
  ]
},
{
  label: '一级 3',
  children: [{
    label: '二级 3-1',
    imgSrc: 'https://panjiachen.gitee.io/vue-element-admin/static/img/404.a57b6f31.png'
  },
  {
    label: '二级 3-2',
    imgSrc: 'https://panjiachen.gitee.io/vue-element-admin/static/img/404.a57b6f31.png'
  }
  ]
}
]
const detailShowInfo = {
  detailInfo: detailInfo,
  broadInfo: broadInfo,
  histroyShowInfo: histroyShowInfo
}
// 基础信息表单配置
const formData = {
  title: '基础信息',
  formModel: {
    deviceId: '',
    deviceName: '',
    assetCode: '',
    assetNumber: '',
    typeId: '',
    deviceClass: '',
    organId: '',
    responsible: '',
    productDate: new Date(),
    factoryNumber: '',
    deviceModel: '',
    assetValue: '',
    drawPath: ''
  },
  formComponent: [{
    type: 'input',
    label: '设备名称',
    model: 'deviceName',
    keyUpEnter: 'handleFilter',
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  },
  {
    type: 'input',
    label: '固定资产编码',
    model: 'assetCode',
    // option: [1, 2, 3],
    rules: [{ required: true, message: '请输入固定资产编码', trigger: 'blur' }, { max: 30, min: 1, message: '请输入30位以内字符' }]
  },
  {
    type: 'input',
    label: '设备编号',
    model: 'assetNumber',
    format: 'yyyy-MM-dd',
    rules: [{ required: true, message: '请输入设备编号', trigger: 'blur' }, { max: 30, min: 1, message: '请输入30位以内字符' }]
  },
  {
    type: 'select',
    label: '设备类型',
    model: 'deviceClass',
    options: [
      { value: 'A', label: 'A' },
      { value: 'B', label: 'B' },
      { value: 'C', label: 'C' }
    ],
    rules: [{ required: true, message: '请输入设备类型', trigger: 'blur' }]
  },
  {
    type: 'cascader',
    label: '设备分类',
    model: 'typeId',
    options: store.state.app.allCode.assetType ? listTotree(store.state.app.allCode.assetType) : [],
    rules: [{ required: true, message: '请输入设备分类', trigger: 'blur' }]
  },
  {
    type: 'cascader',
    label: '使用部门',
    model: 'organId',
    options: listTotree(store.state.app.allCode.department),
    rules: [{ required: true, message: '请输入使用部门', trigger: 'blur' }]
  },
  {
    type: 'input',
    label: '责任人',
    model: 'responsible',
    rules: [{ required: true, message: '请输入责任人', trigger: 'blur' }, { max: 5, min: 1, message: '请输入5位以内字符' }]
  },
  {
    type: 'datePicker',
    label: '投产日期',
    model: 'productDate',
    format: 'yyyy-MM-dd',
    rules: [{ required: true, message: '请选择投产日期', trigger: 'blur' }]
  },
  {
    type: 'input',
    label: '出厂编号',
    model: 'factoryNumber',
    format: 'yyyy-MM-dd',
    rules: [{ required: true, message: '请输入出厂编号', trigger: 'blur' }, { max: 30, min: 1, message: '请输入30位以内字符' }]
  },
  {
    type: 'input',
    label: '型号',
    model: 'deviceModel',
    rules: [{ required: true, message: '请输入型号', trigger: 'blur' }, { max: 30, min: 1, message: '请输入30位以内字符' }]
  },
  {
    type: 'input',
    label: '设备原值',
    model: 'assetValue',
    rules: [{ required: true, message: '请输入设备原值', trigger: 'blur' }, { max: 10, min: 1, message: '请输入10位以内数字', trigger: 'blur' }]
  },
  {
    type: 'upload',
    label: '设备主图',
    model: 'drawPath',
    rules: [{ required: true, message: '请输入设备主图', trigger: 'blur' }]
  }
  ]
}
// 扩展字段信息
const broadData = {
  title: '扩展信息',
  formModel: {},
  formComponent: []
}
// 档案信息
const histroyInfo = {
  title: '档案信息',
  formModel: {
    archives: []
  },
  formComponent: [{
    type: 'upload',
    label: '设备档案',
    model: 'archives',
    keyUpEnter: 'handleFilter',
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  }]
}
// 整理后的表单配置
const totalForm = [{
  formName: '基础信息',
  formRef: 'table1', // 表单ref
  formModel: formData.formModel, // 表单model
  formComponent: formData.formComponent,
  formName: formData.title // 表单标题
},
{
  fromName: '扩展信息',
  formRef: 'table2', // 表单ref
  formModel: broadData.formModel, // 表单model
  formComponent: broadData.formComponent,
  formName: broadData.title // 表单标题
},
{
  formName: '档案信息',
  formRef: 'table3', // 表单ref
  formModel: histroyInfo.formModel, // 表单model
  formComponent: histroyInfo.formComponent,
  formName: histroyInfo.title, // 表单标题
  formStyle: 'box-margin-card'
}
]

const data = {
  totalForm: totalForm,
  // ----------表单显示相关---------//
  detailShowInfo: detailShowInfo
}

export default data
